package com.csw.mysqldate.controller;

import com.csw.mysqldate.dao.UserDao;
import com.csw.mysqldate.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.UUID;

@RestController
@Slf4j
@RequestMapping("returnObject")
public class ReturnObjectTest {
    @Autowired
    private UserDao userDao;

    @RequestMapping("update")
    public void update() {
        User user = new User();
        user.setId(1);
        user.setCreateTime(new Date());
        int i = userDao.updateBy(user);
    }

    @RequestMapping("insert")
    public void insert() {
        User user = new User();
        user.setCreateTime(new Date());
        user.setCommit(UUID.randomUUID().toString());
        int i = userDao.insertBy(user);
    }
}
